package lambda;

import dto.Person;
import lambda.interfaces.PersonFactory;
import org.junit.Test;

/**
 * @author kxd
 * 四，使用构造函数引用将他们关联起来，使用Person::new获取person类构造函数的引用
 */
public class PersonFactoryTest {

    @Test
    public void test() {
        PersonFactory<Person> personFactory = new PersonFactory<Person>() {
            @Override
            public Person create(String firstName, String lastName) {
                return new Person(firstName, lastName);
            }
        };
        Person person = personFactory.create("Peter", "Mr");
    }
}
